import Vue from 'vue'
import App from './App'
import store from './store/index.js'

const msg = (title, duration = 1500, mask = false, icon = 'none') => {
	//统一提示方便全局修改
	if (Boolean(title) === false) {
		return
	}
	uni.showToast({
		title,
		duration,
		mask,
		icon
	})
}

const prePage = () => {
	let pages = getCurrentPages();
	let prePage = pages[pages.length - 2];
	// #ifdef H5
	return prePage;
	// #endif
	return prePage.$vm;
}

Vue.config.productionTip = false
Vue.prototype.$store = store
Vue.prototype.$api = {
	msg,
	prePage
}
App.mpType = 'app'

import _ from 'lodash';
Vue.prototype.$_ = _;

import config from "./common/config.js"
Vue.prototype.baseUrl = config.baseUrl
const app = new Vue({
	...App
})
app.$mount()


import * as publicJs from '@/common/public.js'
Vue.prototype.$public = publicJs


// 导入并挂载全局的分享方法
import share from '@/common/share.js'
Vue.mixin(share)